<!DOCTYPE html>
<html>
<head>
<title>Get Work Order Web</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</head>
<body>
<?
	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);

	$part=strtoupper(trim($part));

	include "top.php";

	echo "<div class='container-fluid'>";
	echo "<div style='float:left'>";
	echo "	<form action='getpart.php' method='POST' role='form' class='form-inline'>";
	echo "		<div class='form-group'>";
	echo "			<label for='inputSN' class='col-sm-4 form-control'>料号查询</label>";
	if(strlen($part)<=0){
		echo "			<input type='text' class='form-control' name='part' id='inputSN' placeholder='请输入料号'>";
	}else{
		echo "			<input type='text' class='form-control' name='part' id='inputSN' value='${part}'>";
	}
	echo "			<button type='submit' class='btn btn-info form-control'>查询</button>";
	echo "		</div>";
	echo "	</form>";
	echo "</div>";
	echo "<br><br>";
	
	if(strlen($part)<=0)
		echo "<div><font color='blue'>You need to input part number</font></div>";
	else{
	
		$soapcli = new SoapClient("http://10.100.160.47:6000/Service.asmx?wsdl");  

		$result = $soapcli->GET_PART_SPEC(array('part'=>$part, 'Tres'=>''));
		//print_r($result); //Debug
		$arrRes = json_decode(json_encode($result),TRUE);
		if(!strstr($arrRes['GET_PART_SPECResult'],"")){
			$i=1;
			echo "<table border=0  width=100% cellpadding=0 cellspacing=1><tr bgcolor='#2894FF'><th width=15%><font color='#ffffff'>料号</font></th><th width=85%><font color='#ffffff'>描述</font></th><tr>";
			$arr = explode("|",$arrRes['GET_PART_SPECResult']);
			foreach($arr as $u){
				$strarr = explode("$",$u);
				if($i>0)
					echo "<tr><td>$strarr[0]</td><td>$strarr[1]</td><tr>\n";
				else
					echo "<tr bgcolor='#d0d0d0'><td>$strarr[0]</td><td>$strarr[1]</td><tr>\n";
				$i=-$i;
			}
		echo "</table>";
		}else{
			echo "<div><font color='red'>part number is error</font></div>";
		}
	}

	echo "</div>";
	include 'bottom.php';
?>
</body>
</html>